package com.ftu.study.pattern.component;

/**
 * Created by zhanghr on 2018/12/22.
 */
public class MenuItem extends MenuComponent {
    String name;
    String description;
    boolean isVegetarian;
    double price;

    public MenuItem(String name, String description, boolean isVegetarian,
                    double price) {
        this.name = name;
        this.description = description;
        this.isVegetarian = isVegetarian;
        this.price = price;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public String getDescription() {
        return description;
    }

    @Override
    public double getPrice() {
        return price;
    }

    @Override
    public boolean isVegetarian() {
        return isVegetarian;
    }

    @Override
    public void print() {
        System.out.print("" + getName());
        if(isVegetarian) {
            System.out.print("(v)");
        }
        System.out.println("," + getPrice());
        System.out.println("   ---" + getDescription());
    }
}
